﻿#region License
/* **********************************************************************************
 * Copyright (c) Haugen Applications LLC
 * This source code is subject to terms and conditions of the MIT License
 * for UserScript. A copy of the license can be found on the License tab for this CodePlex release
 * By using this source code in any fashion, you are agreeing to be bound by the terms of the 
 * MIT License.
 * You must not remove this notice from this software.
 * **********************************************************************************/
#endregion

using UserScript.ExpressionParsing.Irony.Parsing;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Text;

namespace UserScript.ExpressionParsing
{
    internal static class ExpressionParser
    {
        public static ParseTree ParseExpression(string expression)
        {
            var grammar = new ExpressionGrammar();
            var parser = new Parser(grammar);

            if (parser.Language.CanParse())
            {

                parser.Parse(expression);

                return parser.Context.CurrentParseTree;
            }
            else
            {
                return null;
            }
        }
    }
}